package com.yanqu.road.logic.activity.foxcard.game.effect;

import com.yanqu.road.entity.activity.foxcard.FoxBaseCard;
import com.yanqu.road.entity.activity.foxcard.UserFoxCardMonster;
import com.yanqu.road.entity.activity.foxcard.FoxHandCard;
import com.yanqu.road.entity.activity.foxcard.UserFoxCardGameData;
import com.yanqu.road.logic.activity.foxcard.game.FoxCardGameLogic;
import com.yanqu.road.logic.activity.foxcard.game.eFoxCardShowType;
import com.yanqu.road.logic.activity.foxcard.game.eFoxCardTriggerType;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * 回合结束时 初始给效果，每次打过boss怪效果加强
 * 0|加筹码基础值|乘筹码基础值|加倍率基础值|乘倍率基础值|金币基础值
 * 加筹码增幅值|乘筹码增幅值|加倍率增幅值|乘倍率增幅值|金币增幅值
 */
public class FoxCardEffect34 extends FoxCardEffectBase {
    @Override
    protected void effectHandle(FoxCardGameLogic gameLogic, FoxHandCard handCard) {
        if (triggerType == eFoxCardTriggerType.ADD && handCard == null) {
            effectCard.setEffectValues(Collections.singletonList(0l));
        }

        if (triggerType == eFoxCardTriggerType.ROUND_END) {
            UserFoxCardGameData gameData = gameLogic.getGameData();
            UserFoxCardMonster monster = gameData.getMonster(gameData.getRound());
            if (monster.getBossLimitEffect() > 0) {
                if (effectCard.getEffectValues().isEmpty()) {
                    List<Long> effectValues = new ArrayList<>();
                    effectValues.add(0L);
                    effectCard.setEffectValues(effectValues);
                }
                long level = effectCard.getEffectValues().get(0);
                level++;
                effectCard.getEffectValues().set(0, level);
                gameLogic.newFoxShow(eFoxCardShowType.EFFECT_CARD_LV_UP.getValue()).setSettleCards(Collections.singletonList(effectCard)).setShowValue(1).setTriggerType(triggerType.getValue());
            }

            long level = 0;
            if (effectCard.getEffectValues().size() > 0) {
                level = effectCard.getEffectValues().get(0);
            }
            int goldChange = Integer.valueOf(effectConfig.getParamsList().get(5)) + Integer.valueOf(effectConfig.getUpgradeParamsList().get(4)) * (int) level;

            List<FoxBaseCard> foxEffectCards = Collections.singletonList(effectCard);
            gameLogic.goldChange(goldChange, foxEffectCards, null, triggerType); //加金币
        }
    }
}
